\doxysection{LK9025.\+h}
\hypertarget{_l_k9025_8h_source}{}\label{_l_k9025_8h_source}\index{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/modules/motor/LKmotor/LK9025.h@{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/modules/motor/LKmotor/LK9025.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#ifndef\ LK9025\_H}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#define\ LK9025\_H}}
\DoxyCodeLine{00003\ }
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ "{}stdint.h"{}}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}bsp\_can.h"{}}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{controller_8h}{controller.h}}"{}}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{motor__def_8h}{motor\_def.h}}"{}}}
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include\ "{}daemon.h"{}}}
\DoxyCodeLine{00009\ }
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#define\ LK\_MOTOR\_MX\_CNT\ 4\ }\textcolor{comment}{//\ 最多允许4个LK电机使用多电机指令,挂载在一条总线上}}
\DoxyCodeLine{00011\ }
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#define\ I\_MIN\ -\/2000}}
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#define\ I\_MAX\ 2000}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#define\ CURRENT\_SMOOTH\_COEF\ 0.9f}}
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#define\ SPEED\_SMOOTH\_COEF\ 0.85f}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#define\ REDUCTION\_RATIO\_DRIVEN\ 1}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#define\ ECD\_ANGLE\_COEF\_LK\ (360.0f\ /\ 65536.0f)}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#define\ CURRENT\_TORQUE\_COEF\_LK\ 0.00512f\ \ }\textcolor{comment}{//\ 电流设定值转换成扭矩的系数，这里对应的是16T}}
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\textcolor{comment}{//\ 9025}}
\DoxyCodeLine{00021\ \{}
\DoxyCodeLine{00022\ \ \ \ \ uint16\_t\ last\_ecd;\ \ \ \ \ \ \ \ \textcolor{comment}{//\ 上一次读取的编码器值}}
\DoxyCodeLine{00023\ \ \ \ \ uint16\_t\ ecd;\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 当前编码器值}}
\DoxyCodeLine{00024\ \ \ \ \ \textcolor{keywordtype}{float}\ angle\_single\_round;\ \textcolor{comment}{//\ 单圈角度}}
\DoxyCodeLine{00025\ \ \ \ \ \textcolor{keywordtype}{float}\ speed\_rads;\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ speed\ rad/s}}
\DoxyCodeLine{00026\ \ \ \ \ int16\_t\ real\_current;\ \ \ \ \ \textcolor{comment}{//\ 实际电流}}
\DoxyCodeLine{00027\ \ \ \ \ uint8\_t\ temperature;\ \ \ \ \ \ \textcolor{comment}{//\ 温度,C°}}
\DoxyCodeLine{00028\ }
\DoxyCodeLine{00029\ \ \ \ \ \textcolor{keywordtype}{float}\ total\_angle;\ \ \ \textcolor{comment}{//\ 总角度}}
\DoxyCodeLine{00030\ \ \ \ \ int32\_t\ total\_round;\ \textcolor{comment}{//\ 总圈数}}
\DoxyCodeLine{00031\ }
\DoxyCodeLine{00032\ \ \ \ \ \textcolor{keywordtype}{float}\ feed\_dt;}
\DoxyCodeLine{00033\ \ \ \ \ uint32\_t\ feed\_dwt\_cnt;}
\DoxyCodeLine{00034\ \}\ \mbox{\hyperlink{struct_l_k_motor___measure__t}{LKMotor\_Measure\_t}};}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{00037\ \{}
\DoxyCodeLine{00038\ \ \ \ \ \mbox{\hyperlink{struct_l_k_motor___measure__t}{LKMotor\_Measure\_t}}\ measure;}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00040\ \ \ \ \ \mbox{\hyperlink{struct_motor___control___setting__s}{Motor\_Control\_Setting\_s}}\ motor\_settings;}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ \ \ \ \ \textcolor{keywordtype}{float}\ *other\_angle\_feedback\_ptr;\ \textcolor{comment}{//\ 其他反馈来源的反馈数据指针}}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keywordtype}{float}\ *other\_speed\_feedback\_ptr;}
\DoxyCodeLine{00044\ \ \ \ \ \textcolor{keywordtype}{float}\ *speed\_feedforward\_ptr;\ \ \ \textcolor{comment}{//\ 速度前馈数据指针,可以通过此指针设置速度前馈值,或LQR等时作为速度状态变量的输入}}
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keywordtype}{float}\ *current\_feedforward\_ptr;\ \textcolor{comment}{//\ 电流前馈指针}}
\DoxyCodeLine{00046\ \ \ \ \ \mbox{\hyperlink{struct_p_i_d_instance}{PIDInstance}}\ current\_PID;}
\DoxyCodeLine{00047\ \ \ \ \ \mbox{\hyperlink{struct_p_i_d_instance}{PIDInstance}}\ speed\_PID;}
\DoxyCodeLine{00048\ \ \ \ \ \mbox{\hyperlink{struct_p_i_d_instance}{PIDInstance}}\ angle\_PID;}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keywordtype}{float}\ pid\_ref;}
\DoxyCodeLine{00050\ }
\DoxyCodeLine{00051\ \ \ \ \ Motor\_Working\_Type\_e\ stop\_flag;\ \textcolor{comment}{//\ 启停标志}}
\DoxyCodeLine{00052\ }
\DoxyCodeLine{00053\ \ \ \ \ CANInstance\ *motor\_can\_ins;}
\DoxyCodeLine{00054\ }
\DoxyCodeLine{00055\ \ \ \ \ DaemonInstance\ *daemon;}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \}\ \mbox{\hyperlink{struct_l_k_motor_instance}{LKMotorInstance}};}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00065\ \mbox{\hyperlink{struct_l_k_motor_instance}{LKMotorInstance}}\ *LKMotorInit(\mbox{\hyperlink{struct_motor___init___config__s}{Motor\_Init\_Config\_s}}\ *config);}
\DoxyCodeLine{00066\ }
\DoxyCodeLine{00074\ \textcolor{keywordtype}{void}\ LKMotorSetRef(\mbox{\hyperlink{struct_l_k_motor_instance}{LKMotorInstance}}\ *motor,\ \textcolor{keywordtype}{float}\ ref);}
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00080\ \textcolor{keywordtype}{void}\ LKMotorControl();}
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00087\ \textcolor{keywordtype}{void}\ LKMotorStop(\mbox{\hyperlink{struct_l_k_motor_instance}{LKMotorInstance}}\ *motor);}
\DoxyCodeLine{00088\ }
\DoxyCodeLine{00094\ \textcolor{keywordtype}{void}\ LKMotorEnable(\mbox{\hyperlink{struct_l_k_motor_instance}{LKMotorInstance}}\ *motor);}
\DoxyCodeLine{00095\ }
\DoxyCodeLine{00096\ uint8\_t\ LKMotorIsOnline(\mbox{\hyperlink{struct_l_k_motor_instance}{LKMotorInstance}}\ *motor);}
\DoxyCodeLine{00097\ }
\DoxyCodeLine{00098\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ LK9025\_H}}

\end{DoxyCode}
